package com.doit.day02

import com.doit.day01.Hero

class ScalaIterable extends Iterable[Hero]{
  override def iterator: Iterator[Hero] = new ScalaIterator
}


object Test2{
  def main(args: Array[String]): Unit = {
    val iterable: ScalaIterable = new ScalaIterable
    for (elem <- iterable) {
      println(elem)
    }

    val iterator: Iterator[Hero] = iterable.iterator
    while (iterator.hasNext){
      println(iterator.next())
    }
  }
}